package com.lge.qcontact.configuration;

import java.util.ArrayList;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.lge.qcontact.MainActivity;
import com.lge.qcontact.R;

public class ConfigurationActivity extends Activity {
	
	public enum MENU_ITEM{
		AUTO_LOGIN, SYNCHRONIZATION, NOTICE, NOTIFICATION, ABOUT
	}
	
	private static final int AUTO_LOGIN = 0;
	private static final int FIX_MYINFO = 1;
	private static final int DROP_OUP = 2;
	private static final int FIX_GROUP = 3;
	private static final int ABOUT = 4;
	
	private String[] configureMenu = new String[]{
			"자동 로그인 설정",
			"내 정보 변경",
			"회원 탈퇴",
			"그룹 변경",
			"about..."
	};
	
	private ArrayList<String> configMenu = new ArrayList<String>();
	
	private ListView menuList;
	private ArrayAdapter<String> menuListAdapter;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_configuration);
		
		menuList = (ListView)findViewById(R.id.listConfiguration);
		menuListAdapter = new ArrayAdapter<String>(getBaseContext(), R.layout.configure_menu_item, configureMenu);
		menuList.setAdapter(menuListAdapter);
		menuList.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> menuList, View view, int position,
					long arg3) {
				Intent intent = new Intent();
				
				switch(position){
				case ConfigurationActivity.AUTO_LOGIN :
					intent.setClass(getApplicationContext(), SetAutoLoginActivity.class);
					startActivity(intent);
					break;
				case ConfigurationActivity.FIX_MYINFO :
					intent.setClass(getApplicationContext(), FixMyInfoActiviy.class);
					startActivity(intent);
					break;
				case ConfigurationActivity.DROP_OUP :
					intent.setClass(getApplicationContext(), DropOutActivity.class);
					startActivity(intent);
					break;
				case ConfigurationActivity.FIX_GROUP :
					intent.setClass(getApplicationContext(), FixGroupActivity.class);
					startActivity(intent);
					break;
				case ConfigurationActivity.ABOUT :
					AlertDialog.Builder builder = new AlertDialog.Builder(ConfigurationActivity.this);
					builder.setTitle("About...");
					builder.setMessage("QContact ver 1.0.103\n" +
												  "developed by 28.6\n" +
												  "email : qMaster@lge.com");
					builder.setPositiveButton("확인", new DialogInterface.OnClickListener() {
						
						@Override
						public void onClick(DialogInterface arg0, int arg1) {
							
						}
					});
					builder.show();
					
					break;
				}
				
				
			}
		});
		
		
	}
}
